package com.skyworth.web.api;

import com.skyworth.web.admin.store.form.StoreForm;
import com.skyworth.web.admin.store.model.StoreModel;
import com.skyworth.web.admin.store.service.StoreService;
import com.skyworth.web.admin.user.domain.UserKind;
import com.skyworth.web.admin.user.domain.UserModel;
import com.skyworth.web.admin.user.form.UserForm;
import com.skyworth.web.admin.user.repository.UserRepository;
import com.skyworth.web.admin.user.service.UserService;
import com.skyworth.web.common.ApiResponse;
import com.skyworth.web.common.controller.BaseController;
import com.skyworth.web.shiro.redis.RedisService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;




@RestController
public class UserController extends BaseController {
    Logger LOG = LoggerFactory.getLogger(UserController.class);

    @Autowired
    private UserService userService;

    @Autowired
    private UserRepository userRepository;

    @Autowired
    private StoreService storeService;

    @Autowired
    private RedisService redisService;


    @RequestMapping(value={"/user/register"},method = RequestMethod.GET)
    public String register() {
        return "user/register";
    }
    

    @RequestMapping(value = {"/api/user/update_edu_info"}, method = RequestMethod.POST)
    public ApiResponse updateEduInfo(@RequestBody Map<String, Object> map) {

        UserModel currentUser = currentUser();

        ApiResponse apiResponse = new ApiResponse();
        apiResponse.setSuccess(true);


        userRepository.save(currentUser);

        apiResponse.setData(currentUser);

        return apiResponse;
    }


}
